package com.settlement.system.controller;

import com.settlement.system.model.entity.common.TblOrderChannelShops;
import com.settlement.system.reply.ObjectDataResponse;
import com.settlement.system.service.IBaseService;
import com.settlement.system.service.ITblOrderChannelShopsService;
import com.settlement.system.common.util.common.FasUtil;
import com.alibaba.excel.context.AnalysisContext;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 订单稽核-三级来源多店铺 前端控制器
 * @author xiaochuan
 * @since 2021-04-26
 */

@Api(tags = "订单稽核-三级来源多店铺",description = "订单稽核-三级来源多店铺")
@RestController
@RequestMapping("/order/channel/shops")
public class TblOrderChannelShopsController extends ExcelController<TblOrderChannelShops> {

    @Resource
    private ITblOrderChannelShopsService tblOrderChannelShopsService;

    @Override
    public IBaseService init() {
        return tblOrderChannelShopsService;
    }

    @Override
    public Class<?> getModelClass() {
        return TblOrderChannelShops.class;
    }

    @Override
    protected void setParamsModel(Map<String, Object> model) {
        FasUtil.formatInQueryCondition(model, "shopNoList","threeLevelChannelNo");
    }

    @Override
    public ObjectDataResponse importFile(MultipartFile file, HttpServletRequest request) {
        ObjectDataResponse objectDataResponse = super.importFile(file, request);
        tblOrderChannelShopsService.updateOrganTypeNoFromMasterData();
        return objectDataResponse;
    }
}

